package com.example.demo0905.controller;

import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/login")
    public String login(String username, String password) {
        if(!StringUtils.hasLength(username) || !StringUtils.hasLength(password)) {
            return "用户名或密码不能为空";
        }
        if(username.equals("cy") && password.equals("123")) {
            return "登录成功!";
        } else {
            return "登录失败！";
        }
    }

}
